/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * ProcesoSubBytesUI.java
 *
 * Created on 08-jun-2010, 17:46:18
 */

package aesphere;

import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.StringSelection;
import java.awt.datatransfer.Transferable;
import java.io.File;
import java.net.URL;
import javax.help.HelpBroker;
import javax.help.HelpSet;
import javax.swing.JOptionPane;

/**
 *
 * @author antonio
 */
public class ProcesoSubBytesUI extends javax.swing.JFrame {
    private MainHerramientasUI wpadre;   

    public ProcesoSubBytesUI(MainHerramientasUI padre) {
        initComponents();
        setLangLabels();
        wpadre=padre;
        this.setSize(595, 390);
        CopiarOutput.setEnabled(false);
        setHelp();
        this.setResizable(false);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")


    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        EjecutarButton = new javax.swing.JButton();
        inputPanel = new javax.swing.JPanel();
        a32 = new javax.swing.JTextField();
        a23 = new javax.swing.JTextField();
        a42 = new javax.swing.JTextField();
        a24 = new javax.swing.JTextField();
        a31 = new javax.swing.JTextField();
        a44 = new javax.swing.JTextField();
        a13 = new javax.swing.JTextField();
        a41 = new javax.swing.JTextField();
        a11 = new javax.swing.JTextField();
        a21 = new javax.swing.JTextField();
        a22 = new javax.swing.JTextField();
        a34 = new javax.swing.JTextField();
        a14 = new javax.swing.JTextField();
        a33 = new javax.swing.JTextField();
        a43 = new javax.swing.JTextField();
        a12 = new javax.swing.JTextField();
        outputPanel = new javax.swing.JPanel();
        b21 = new javax.swing.JTextField();
        b24 = new javax.swing.JTextField();
        b11 = new javax.swing.JTextField();
        b34 = new javax.swing.JTextField();
        b41 = new javax.swing.JTextField();
        b33 = new javax.swing.JTextField();
        b32 = new javax.swing.JTextField();
        b42 = new javax.swing.JTextField();
        b22 = new javax.swing.JTextField();
        b14 = new javax.swing.JTextField();
        b12 = new javax.swing.JTextField();
        b31 = new javax.swing.JTextField();
        b43 = new javax.swing.JTextField();
        b13 = new javax.swing.JTextField();
        b23 = new javax.swing.JTextField();
        b44 = new javax.swing.JTextField();
        titleLabel = new javax.swing.JLabel();
        AtrasButton = new javax.swing.JButton();
        BotonInfo = new javax.swing.JButton();
        RandomButton = new javax.swing.JButton();
        cifradoMenuBarMain = new javax.swing.JMenuBar();
        mainMenuArchivoCifrado = new javax.swing.JMenu();
        Salir = new javax.swing.JMenuItem();
        mainMenuEditarCifrado = new javax.swing.JMenu();
        cleanFieldsMenu = new javax.swing.JMenuItem();
        CopiarInput = new javax.swing.JMenuItem();
        CopiarOutput = new javax.swing.JMenuItem();
        pegarInput = new javax.swing.JMenuItem();
        mainMenuAyudaCifrado = new javax.swing.JMenu();
        Contenidos = new javax.swing.JMenuItem();
        acercade = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("AESphere - SubBytes");
        setResizable(false);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent evt) {
                formWindowClosing(evt);
            }
        });

        EjecutarButton.setText("Ejecutar");
        EjecutarButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                EjecutarButtonActionPerformed(evt);
            }
        });

        inputPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("INPUT"));

        a32.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                a32KeyReleased(evt);
            }
            public void keyTyped(java.awt.event.KeyEvent evt) {
                a32KeyTyped(evt);
            }
        });

        a23.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                a23KeyReleased(evt);
            }
            public void keyTyped(java.awt.event.KeyEvent evt) {
                a23KeyTyped(evt);
            }
        });

        a42.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                a42KeyReleased(evt);
            }
            public void keyTyped(java.awt.event.KeyEvent evt) {
                a42KeyTyped(evt);
            }
        });

        a24.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                a24KeyReleased(evt);
            }
            public void keyTyped(java.awt.event.KeyEvent evt) {
                a24KeyTyped(evt);
            }
        });

        a31.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                a31KeyReleased(evt);
            }
            public void keyTyped(java.awt.event.KeyEvent evt) {
                a31KeyTyped(evt);
            }
        });

        a44.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                a44KeyReleased(evt);
            }
            public void keyTyped(java.awt.event.KeyEvent evt) {
                a44KeyTyped(evt);
            }
        });

        a13.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                a13KeyReleased(evt);
            }
            public void keyTyped(java.awt.event.KeyEvent evt) {
                a13KeyTyped(evt);
            }
        });

        a41.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                a41KeyReleased(evt);
            }
            public void keyTyped(java.awt.event.KeyEvent evt) {
                a41KeyTyped(evt);
            }
        });

        a11.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                a11KeyReleased(evt);
            }
            public void keyTyped(java.awt.event.KeyEvent evt) {
                a11KeyTyped(evt);
            }
        });

        a21.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                a21KeyReleased(evt);
            }
            public void keyTyped(java.awt.event.KeyEvent evt) {
                a21KeyTyped(evt);
            }
        });

        a22.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                a22KeyReleased(evt);
            }
            public void keyTyped(java.awt.event.KeyEvent evt) {
                a22KeyTyped(evt);
            }
        });

        a34.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                a34KeyReleased(evt);
            }
            public void keyTyped(java.awt.event.KeyEvent evt) {
                a34KeyTyped(evt);
            }
        });

        a14.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                a14KeyReleased(evt);
            }
            public void keyTyped(java.awt.event.KeyEvent evt) {
                a14KeyTyped(evt);
            }
        });

        a33.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                a33ActionPerformed(evt);
            }
        });
        a33.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                a33KeyReleased(evt);
            }
            public void keyTyped(java.awt.event.KeyEvent evt) {
                a33KeyTyped(evt);
            }
        });

        a43.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                a43KeyReleased(evt);
            }
            public void keyTyped(java.awt.event.KeyEvent evt) {
                a43KeyTyped(evt);
            }
        });

        a12.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                a12KeyReleased(evt);
            }
            public void keyTyped(java.awt.event.KeyEvent evt) {
                a12KeyTyped(evt);
            }
        });

        org.jdesktop.layout.GroupLayout inputPanelLayout = new org.jdesktop.layout.GroupLayout(inputPanel);
        inputPanel.setLayout(inputPanelLayout);
        inputPanelLayout.setHorizontalGroup(
            inputPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(inputPanelLayout.createSequentialGroup()
                .addContainerGap()
                .add(inputPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(a11, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 36, Short.MAX_VALUE)
                    .add(a21, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 36, Short.MAX_VALUE)
                    .add(a31, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 36, Short.MAX_VALUE)
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, a41, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 36, Short.MAX_VALUE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(inputPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, inputPanelLayout.createSequentialGroup()
                        .add(a42, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 36, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                        .add(a43, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 36, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                        .add(a44, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 36, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, inputPanelLayout.createSequentialGroup()
                        .add(inputPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(a12, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 36, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(a22, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 36, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(a32, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 36, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                        .add(inputPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(a13, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 36, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(a23, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 36, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(a33, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 36, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                        .add(inputPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(a24, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 36, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(a14, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 36, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(a34, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 36, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))))
                .addContainerGap())
        );
        inputPanelLayout.setVerticalGroup(
            inputPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(inputPanelLayout.createSequentialGroup()
                .addContainerGap()
                .add(inputPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(a11, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(a12, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(a13, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(a14, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .add(11, 11, 11)
                .add(inputPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(a21, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(a22, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(a23, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(a24, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .add(11, 11, 11)
                .add(inputPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(a31, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(a32, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(a33, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(a34, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(inputPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(a41, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(a42, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(a43, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(a44, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        outputPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("OUTPUT"));

        b21.setEditable(false);
        b21.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                b21ActionPerformed(evt);
            }
        });

        b24.setEditable(false);

        b11.setEditable(false);

        b34.setEditable(false);

        b41.setEditable(false);

        b33.setEditable(false);

        b32.setEditable(false);

        b42.setEditable(false);

        b22.setEditable(false);

        b14.setEditable(false);
        b14.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                b14ActionPerformed(evt);
            }
        });

        b12.setEditable(false);

        b31.setEditable(false);

        b43.setEditable(false);

        b13.setEditable(false);
        b13.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                b13ActionPerformed(evt);
            }
        });

        b23.setEditable(false);
        b23.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                b23ActionPerformed(evt);
            }
        });

        b44.setEditable(false);

        org.jdesktop.layout.GroupLayout outputPanelLayout = new org.jdesktop.layout.GroupLayout(outputPanel);
        outputPanel.setLayout(outputPanelLayout);
        outputPanelLayout.setHorizontalGroup(
            outputPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(outputPanelLayout.createSequentialGroup()
                .addContainerGap()
                .add(outputPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(b41, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 36, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(b31, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 36, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(b11, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 36, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(b21, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 36, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(outputPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(b42, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 36, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(b32, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 36, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(b12, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 36, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(b22, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 36, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(outputPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(b43, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 36, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(b33, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 36, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(b13, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 36, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(b23, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 36, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(outputPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(b44, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 36, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(b34, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 36, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(b24, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 36, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(b14, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 36, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );
        outputPanelLayout.setVerticalGroup(
            outputPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(outputPanelLayout.createSequentialGroup()
                .addContainerGap()
                .add(outputPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(outputPanelLayout.createSequentialGroup()
                        .add(b14, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(11, 11, 11)
                        .add(b24, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(11, 11, 11)
                        .add(b34, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(11, 11, 11)
                        .add(b44, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .add(outputPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                        .add(outputPanelLayout.createSequentialGroup()
                            .add(b13, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(11, 11, 11)
                            .add(b23, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(11, 11, 11)
                            .add(b33, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(11, 11, 11)
                            .add(b43, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                        .add(outputPanelLayout.createSequentialGroup()
                            .add(b12, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(11, 11, 11)
                            .add(b22, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(11, 11, 11)
                            .add(b32, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(11, 11, 11)
                            .add(b42, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                        .add(outputPanelLayout.createSequentialGroup()
                            .add(b11, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(11, 11, 11)
                            .add(b21, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(11, 11, 11)
                            .add(b31, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(11, 11, 11)
                            .add(b41, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))))
                .addContainerGap())
        );

        titleLabel.setFont(new java.awt.Font("Lucida Grande", 0, 18));
        titleLabel.setText("Proceso de SubBytes");

        AtrasButton.setText("Atrás");
        AtrasButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                AtrasButtonActionPerformed(evt);
            }
        });

        BotonInfo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/info.png"))); // NOI18N
        BotonInfo.setBorder(null);
        BotonInfo.setContentAreaFilled(false);
        BotonInfo.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));

        RandomButton.setText("Random");
        RandomButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                RandomButtonActionPerformed(evt);
            }
        });

        mainMenuArchivoCifrado.setText("Archivo");

        Salir.setText("Salir");
        Salir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                SalirActionPerformed(evt);
            }
        });
        mainMenuArchivoCifrado.add(Salir);

        cifradoMenuBarMain.add(mainMenuArchivoCifrado);

        mainMenuEditarCifrado.setText("Editar");

        cleanFieldsMenu.setText("Limpiar campos");
        cleanFieldsMenu.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cleanFieldsMenuActionPerformed(evt);
            }
        });
        mainMenuEditarCifrado.add(cleanFieldsMenu);

        CopiarInput.setText("Copiar Input");
        CopiarInput.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                CopiarInputActionPerformed(evt);
            }
        });
        mainMenuEditarCifrado.add(CopiarInput);

        CopiarOutput.setText("Copiar Output");
        CopiarOutput.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                CopiarOutputActionPerformed(evt);
            }
        });
        mainMenuEditarCifrado.add(CopiarOutput);

        pegarInput.setText("Pegar Input");
        pegarInput.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                pegarInputActionPerformed(evt);
            }
        });
        mainMenuEditarCifrado.add(pegarInput);

        cifradoMenuBarMain.add(mainMenuEditarCifrado);

        mainMenuAyudaCifrado.setText("Ayuda");

        Contenidos.setText("Contenido");
        Contenidos.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ContenidosActionPerformed(evt);
            }
        });
        mainMenuAyudaCifrado.add(Contenidos);

        acercade.setText("Acerca de");
        mainMenuAyudaCifrado.add(acercade);

        cifradoMenuBarMain.add(mainMenuAyudaCifrado);

        setJMenuBar(cifradoMenuBarMain);

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .add(34, 34, 34)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                        .add(layout.createSequentialGroup()
                            .add(titleLabel)
                            .add(137, 137, 137)
                            .add(BotonInfo))
                        .add(layout.createSequentialGroup()
                            .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                                .add(RandomButton)
                                .add(inputPanel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                            .add(75, 75, 75)
                            .add(outputPanel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 345, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(AtrasButton)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                        .add(EjecutarButton)))
                .addContainerGap(48, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .addContainerGap()
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(BotonInfo)
                    .add(titleLabel))
                .add(32, 32, 32)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                    .add(outputPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .add(inputPanel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(EjecutarButton)
                    .add(AtrasButton)
                    .add(RandomButton))
                .addContainerGap(35, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void setLangLabels () {
        this.setTitle(Entorno.getTrans("Op.sBTitle"));
        titleLabel.setText(Entorno.getTrans("Op.sBTxt"));        
        inputPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(Entorno.getTrans("AES.in").toUpperCase()));
        outputPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(Entorno.getTrans("AES.out").toUpperCase()));
        RandomButton.setText(Entorno.getTrans("Op.rand"));
        AtrasButton.setText(Entorno.getTrans("gen.back"));
        EjecutarButton.setText(Entorno.getTrans("gen.exec"));
        mainMenuArchivoCifrado.setText(Entorno.getTrans("gen.file"));
        Salir.setText(Entorno.getTrans("gen.exit"));
        mainMenuEditarCifrado.setText(Entorno.getTrans("gen.edit"));
        CopiarInput.setText(Entorno.getTrans("AES.copyIn"));        
        CopiarOutput.setText(Entorno.getTrans("Op.copyOut"));
        pegarInput.setText(Entorno.getTrans("AES.pasteIn"));        
        mainMenuAyudaCifrado.setText(Entorno.getTrans("gen.help"));
        Contenidos.setText(Entorno.getTrans("gen.cont"));
        acercade.setText(Entorno.getTrans("gen.about"));
        cleanFieldsMenu.setText(Entorno.getTrans("Op.cleanFields"));
    }
    
    private void setHelp () {

        Dimension pantalla = Toolkit.getDefaultToolkit().getScreenSize();
        Dimension ventana = getSize();

        try {
            File fichero = null;

            if (Entorno.getProperty("language").equals("ES"))
                fichero = new File("help/help_set_ES.hs");
            else if (Entorno.getProperty("language").equals("EN"))
                fichero = new File("help/help_set_EN.hs");
            URL hsURL = fichero.toURI().toURL();
            HelpSet helpset = new HelpSet(getClass().getClassLoader(), hsURL);
            HelpBroker hb = helpset.createHelpBroker();
            hb.setLocation(new java.awt.Point((pantalla.width - ventana.width) / 2,
                                (pantalla.height - ventana.height) / 2));
            hb.setSize(new java.awt.Dimension(800, 628));
            hb.enableHelpOnButton(Contenidos, "ventana_subbytes", helpset);
            hb.enableHelpOnButton(BotonInfo, "ventana_subbytes", helpset);
            hb.enableHelpOnButton(acercade, "aplicacion", helpset);
        }

        catch (Exception e) {
             JOptionPane.showMessageDialog(this, Entorno.getTrans("gen.helpErrMsg"), 
                     Entorno.getTrans("gen.helpErrTitle"), JOptionPane.ERROR_MESSAGE);
        }
    }


    private byte [][] rellenarmatriz () {
        byte[][] matriz = new byte[4][4];

        matriz [0][0]= Conversor.hexPairToByte(a11.getText(), 0);
        matriz [0][1]= Conversor.hexPairToByte(a12.getText(), 0);
        matriz [0][2]= Conversor.hexPairToByte(a13.getText(), 0);
        matriz [0][3]= Conversor.hexPairToByte(a14.getText(), 0);
        matriz [1][0]= Conversor.hexPairToByte(a21.getText(), 0);
        matriz [1][1]= Conversor.hexPairToByte(a22.getText(), 0);
        matriz [1][2]= Conversor.hexPairToByte(a23.getText(), 0);
        matriz [1][3]= Conversor.hexPairToByte(a24.getText(), 0);
        matriz [2][0]= Conversor.hexPairToByte(a31.getText(), 0);
        matriz [2][1]= Conversor.hexPairToByte(a32.getText(), 0);
        matriz [2][2]= Conversor.hexPairToByte(a33.getText(), 0);
        matriz [2][3]= Conversor.hexPairToByte(a34.getText(), 0);
        matriz [3][0]= Conversor.hexPairToByte(a41.getText(), 0);
        matriz [3][1]= Conversor.hexPairToByte(a42.getText(), 0);
        matriz [3][2]= Conversor.hexPairToByte(a43.getText(), 0);
        matriz [3][3]= Conversor.hexPairToByte(a44.getText(), 0);

        return matriz;
    }


    private void rellenaroutput (byte [] [] matrizsalida) {

        b11.setText(Conversor.byteToHexPair(matrizsalida[0][0]));
        b12.setText(Conversor.byteToHexPair(matrizsalida[0][1]));
        b13.setText(Conversor.byteToHexPair(matrizsalida[0][2]));
        b14.setText(Conversor.byteToHexPair(matrizsalida[0][3]));
        b21.setText(Conversor.byteToHexPair(matrizsalida[1][0]));
        b22.setText(Conversor.byteToHexPair(matrizsalida[1][1]));
        b23.setText(Conversor.byteToHexPair(matrizsalida[1][2]));
        b24.setText(Conversor.byteToHexPair(matrizsalida[1][3]));
        b31.setText(Conversor.byteToHexPair(matrizsalida[2][0]));
        b32.setText(Conversor.byteToHexPair(matrizsalida[2][1]));
        b33.setText(Conversor.byteToHexPair(matrizsalida[2][2]));
        b34.setText(Conversor.byteToHexPair(matrizsalida[2][3]));
        b41.setText(Conversor.byteToHexPair(matrizsalida[3][0]));
        b42.setText(Conversor.byteToHexPair(matrizsalida[3][1]));
        b43.setText(Conversor.byteToHexPair(matrizsalida[3][2]));
        b44.setText(Conversor.byteToHexPair(matrizsalida[3][3]));

    }

   private boolean ComprobarHexadecimal (String cadena){

    boolean resul = true;

    for (int i = 0; i < cadena.length() ; i++){

      if ( ((cadena.charAt(i) >= 'A') & (cadena.charAt(i) <= 'F')) ||
          ((cadena.charAt(i) >= 'a') & (cadena.charAt(i) <= 'f')) ||
          ((cadena.charAt(i) >= '0') & (cadena.charAt(i) <= '9')));
      else {
          resul=false;
      }
    }

    return resul;


    }

    private boolean ComprobarDatos (){
        boolean aux=true;

       if (aux && (a11.getText().isEmpty() || a12.getText().isEmpty() || a13.getText().isEmpty() || a14.getText().isEmpty()
                || a21.getText().isEmpty() || a22.getText().isEmpty() || a23.getText().isEmpty() || a24.getText().isEmpty()
                || a31.getText().isEmpty() || a32.getText().isEmpty() || a33.getText().isEmpty() || a34.getText().isEmpty()
                || a41.getText().isEmpty() || a42.getText().isEmpty() || a43.getText().isEmpty() || a44.getText().isEmpty())){
           JOptionPane.showMessageDialog(this, Entorno.getTrans("AES.fillWarMsg"),
                   Entorno.getTrans("gen.war"), JOptionPane.WARNING_MESSAGE);
           aux=false;

        }

        if (aux && (!ComprobarHexadecimal (a11.getText()) || !ComprobarHexadecimal (a12.getText()) || !ComprobarHexadecimal (a13.getText()) || !ComprobarHexadecimal (a14.getText())
                 || !ComprobarHexadecimal (a21.getText()) || !ComprobarHexadecimal (a22.getText()) || !ComprobarHexadecimal (a23.getText()) || !ComprobarHexadecimal (a24.getText())
                 || !ComprobarHexadecimal (a31.getText()) || !ComprobarHexadecimal (a32.getText()) || !ComprobarHexadecimal (a33.getText()) || !ComprobarHexadecimal (a34.getText())
                 || !ComprobarHexadecimal (a41.getText()) || !ComprobarHexadecimal (a42.getText()) || !ComprobarHexadecimal (a43.getText()) || !ComprobarHexadecimal (a44.getText()))) {
           JOptionPane.showMessageDialog(this, Entorno.getTrans("Op.hexPairWarMsg"),
                   Entorno.getTrans("gen.war"), JOptionPane.WARNING_MESSAGE);
           aux=false;
        }

        if (aux && (a11.getText().length()!=2 || a12.getText().length()!=2 || a13.getText().length()!=2 || a14.getText().length()!=2
                 || a21.getText().length()!=2 || a22.getText().length()!=2 || a23.getText().length()!=2 || a24.getText().length()!=2
                 || a31.getText().length()!=2 || a32.getText().length()!=2 || a33.getText().length()!=2 || a34.getText().length()!=2
                 || a41.getText().length()!=2 || a42.getText().length()!=2 || a43.getText().length()!=2 || a44.getText().length()!=2 )) {

           JOptionPane.showMessageDialog(this, Entorno.getTrans("Op.hexPairWarMsg"),
                   Entorno.getTrans("gen.war"), JOptionPane.WARNING_MESSAGE);
           aux=false;
        }

        return aux;
    }

    private void SalirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SalirActionPerformed
        this.dispatchEvent(new java.awt.event.WindowEvent(this, java.awt.event.WindowEvent.WINDOW_CLOSING));
}//GEN-LAST:event_SalirActionPerformed

    private void b14ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_b14ActionPerformed
         
    }//GEN-LAST:event_b14ActionPerformed

    private void EjecutarButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_EjecutarButtonActionPerformed
         
      if (ComprobarDatos()) {

        AESencrypt objeto = new AESencrypt();
        byte [][] matrix = rellenarmatriz();
        objeto.SubBytes(matrix);
        rellenaroutput(matrix);
        CopiarOutput.setEnabled(true);

        }
    }//GEN-LAST:event_EjecutarButtonActionPerformed

    private void a33ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_a33ActionPerformed
         
    }//GEN-LAST:event_a33ActionPerformed

    private void b13ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_b13ActionPerformed

    }//GEN-LAST:event_b13ActionPerformed

    private void b21ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_b21ActionPerformed

    }//GEN-LAST:event_b21ActionPerformed

    private void b23ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_b23ActionPerformed

    }//GEN-LAST:event_b23ActionPerformed

    private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
        wpadre.setEnabled(true);
        wpadre.requestFocus();
        wpadre.wclosed(this);
    }//GEN-LAST:event_formWindowClosing

    private void CopiarInputActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CopiarInputActionPerformed
        if (ComprobarDatos()) {

        String cadena = new String();
        byte [][] matriz = rellenarmatriz();

        for (int i = 0; i < 4; i++)
         for (int j = 0; j < 4; j++)
            cadena=cadena + (Conversor.byteToHexPair(matriz[i][j]));


        Clipboard cb = Toolkit.getDefaultToolkit().getSystemClipboard();
        StringSelection ss = new StringSelection(cadena);
        cb.setContents(ss, ss);
        }

    }//GEN-LAST:event_CopiarInputActionPerformed

private void CopiarOutputActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CopiarOutputActionPerformed
        String cadena = new String();
        byte [] [] matriz= new byte [4][4];

        matriz [0][0]= Conversor.hexPairToByte(b11.getText(), 0);
        matriz [0][1]= Conversor.hexPairToByte(b12.getText(), 0);
        matriz [0][2]= Conversor.hexPairToByte(b13.getText(), 0);
        matriz [0][3]= Conversor.hexPairToByte(b14.getText(), 0);
        matriz [1][0]= Conversor.hexPairToByte(b21.getText(), 0);
        matriz [1][1]= Conversor.hexPairToByte(b22.getText(), 0);
        matriz [1][2]= Conversor.hexPairToByte(b23.getText(), 0);
        matriz [1][3]= Conversor.hexPairToByte(b24.getText(), 0);
        matriz [2][0]= Conversor.hexPairToByte(b31.getText(), 0);
        matriz [2][1]= Conversor.hexPairToByte(b32.getText(), 0);
        matriz [2][2]= Conversor.hexPairToByte(b33.getText(), 0);
        matriz [2][3]= Conversor.hexPairToByte(b34.getText(), 0);
        matriz [3][0]= Conversor.hexPairToByte(b41.getText(), 0);
        matriz [3][1]= Conversor.hexPairToByte(b42.getText(), 0);
        matriz [3][2]= Conversor.hexPairToByte(b43.getText(), 0);
        matriz [3][3]= Conversor.hexPairToByte(b44.getText(), 0);

        for (int i = 0; i < 4; i++)
         for (int j = 0; j < 4; j++)
            cadena=cadena + (Conversor.byteToHexPair(matriz[i][j]));

        Clipboard cb = Toolkit.getDefaultToolkit().getSystemClipboard();
        StringSelection ss = new StringSelection(cadena);
        cb.setContents(ss, ss);
}//GEN-LAST:event_CopiarOutputActionPerformed

private void AtrasButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AtrasButtonActionPerformed
    this.dispatchEvent(new java.awt.event.WindowEvent(this, java.awt.event.WindowEvent.WINDOW_CLOSING));
}//GEN-LAST:event_AtrasButtonActionPerformed

private void ContenidosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ContenidosActionPerformed

}//GEN-LAST:event_ContenidosActionPerformed

private void pegarInputActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_pegarInputActionPerformed
      Clipboard cb = Toolkit.getDefaultToolkit().getSystemClipboard();
      Transferable t = cb.getContents(this);


       try{
           DataFlavor dataFlavorStringJava = new DataFlavor("application/x-java-serialized-object; class=java.lang.String");
           if (t.isDataFlavorSupported(dataFlavorStringJava)) {
           String texto = (String) t.getTransferData(dataFlavorStringJava);
           a11.setText(texto.substring(0, 2));
           a12.setText(texto.substring(2, 4));
           a13.setText(texto.substring(4, 6));
           a14.setText(texto.substring(6, 8));
           a21.setText(texto.substring(8, 10));
           a22.setText(texto.substring(10, 12));
           a23.setText(texto.substring(12, 14));
           a24.setText(texto.substring(14, 16));
           a31.setText(texto.substring(16, 18));
           a32.setText(texto.substring(18, 20));
           a33.setText(texto.substring(20, 22));
           a34.setText(texto.substring(22, 24));
           a41.setText(texto.substring(24, 26));
           a42.setText(texto.substring(26, 28));
           a43.setText(texto.substring(28, 30));
           a44.setText(texto.substring(30, 32));
           }
       }
       catch (Exception e){
           JOptionPane.showMessageDialog(this, Entorno.getTrans("gen.pasteErr"),
                   Entorno.getTrans("gen.err"), JOptionPane.ERROR_MESSAGE);
       }
}//GEN-LAST:event_pegarInputActionPerformed

private void RandomButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RandomButtonActionPerformed
    int x = new Double(Math.random() * 239).intValue()+16;
        String a = java.lang.Integer.toHexString(x);
        a11.setText(a);

        x = new Double(Math.random() * 239).intValue()+16;
        a = java.lang.Integer.toHexString(x);
        a12.setText(a);

        x = new Double(Math.random() * 239).intValue()+16;
        a = java.lang.Integer.toHexString(x);
        a13.setText(a);

        x = new Double(Math.random() * 239).intValue()+16;
        a = java.lang.Integer.toHexString(x);
        a14.setText(a);

        x = new Double(Math.random() * 239).intValue()+16;
        a = java.lang.Integer.toHexString(x);
        a21.setText(a);

        x = new Double(Math.random() * 239).intValue()+16;
        a = java.lang.Integer.toHexString(x);
        a22.setText(a);

        x = new Double(Math.random() * 239).intValue()+16;
        a = java.lang.Integer.toHexString(x);
        a23.setText(a);

        x = new Double(Math.random() * 239).intValue()+16;
        a = java.lang.Integer.toHexString(x);
        a24.setText(a);

        x = new Double(Math.random() * 239).intValue()+16;
        a = java.lang.Integer.toHexString(x);
        a31.setText(a);

        x = new Double(Math.random() * 239).intValue()+16;
        a = java.lang.Integer.toHexString(x);
        a32.setText(a);

        x = new Double(Math.random() * 239).intValue()+16;
        a = java.lang.Integer.toHexString(x);
        a33.setText(a);

        x = new Double(Math.random() * 239).intValue()+16;
        a = java.lang.Integer.toHexString(x);
        a34.setText(a);

        x = new Double(Math.random() * 239).intValue()+16;
        a = java.lang.Integer.toHexString(x);
        a41.setText(a);

        x = new Double(Math.random() * 239).intValue()+16;
        a = java.lang.Integer.toHexString(x);
        a42.setText(a);

        x = new Double(Math.random() * 239).intValue()+16;
        a = java.lang.Integer.toHexString(x);
        a43.setText(a);

        x = new Double(Math.random() * 239).intValue()+16;
        a = java.lang.Integer.toHexString(x);
        a44.setText(a);
}//GEN-LAST:event_RandomButtonActionPerformed

private void a11KeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_a11KeyTyped
    if (a11.getText().length() > 2) {
            a11.setText(a11.getText().substring(0, 2));
        }
    
    while (!ComprobarHexadecimal(a11.getText())) {
            a11.setText(a11.getText().substring(0, a11.getText().length() - 1));
        }
}//GEN-LAST:event_a11KeyTyped

private void a11KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_a11KeyReleased
    a11KeyTyped(evt);
}//GEN-LAST:event_a11KeyReleased

private void a12KeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_a12KeyTyped
    if (a12.getText().length() > 2) {
            a12.setText(a12.getText().substring(0, 2));
        }
    
    while (!ComprobarHexadecimal(a12.getText())) {
            a12.setText(a12.getText().substring(0, a12.getText().length() - 1));
        }
}//GEN-LAST:event_a12KeyTyped

private void a12KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_a12KeyReleased
    a12KeyTyped(evt);
}//GEN-LAST:event_a12KeyReleased

private void a13KeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_a13KeyTyped
    if (a13.getText().length() > 2) {
            a13.setText(a13.getText().substring(0, 2));
        }
    
    while (!ComprobarHexadecimal(a13.getText())) {
            a13.setText(a13.getText().substring(0, a13.getText().length() - 1));
        }
}//GEN-LAST:event_a13KeyTyped

private void a13KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_a13KeyReleased
    a13KeyTyped(evt);
}//GEN-LAST:event_a13KeyReleased

private void a14KeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_a14KeyTyped
    if (a14.getText().length() > 2) {
            a14.setText(a14.getText().substring(0, 2));
        }
    
    while (!ComprobarHexadecimal(a14.getText())) {
            a14.setText(a14.getText().substring(0, a14.getText().length() - 1));
        }
}//GEN-LAST:event_a14KeyTyped

private void a14KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_a14KeyReleased
    a14KeyTyped(evt);
}//GEN-LAST:event_a14KeyReleased

private void a21KeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_a21KeyTyped
    if (a21.getText().length() > 2) {
            a21.setText(a21.getText().substring(0, 2));
        }
    
    while (!ComprobarHexadecimal(a21.getText())) {
            a21.setText(a21.getText().substring(0, a21.getText().length() - 1));
        }
}//GEN-LAST:event_a21KeyTyped

private void a21KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_a21KeyReleased
    a21KeyTyped(evt);
}//GEN-LAST:event_a21KeyReleased

private void a22KeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_a22KeyTyped
    if (a22.getText().length() > 2) {
            a22.setText(a22.getText().substring(0, 2));
        }
    
    while (!ComprobarHexadecimal(a22.getText())) {
            a22.setText(a22.getText().substring(0, a22.getText().length() - 1));
        }
}//GEN-LAST:event_a22KeyTyped

private void a22KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_a22KeyReleased
    a22KeyTyped(evt);
}//GEN-LAST:event_a22KeyReleased

private void a23KeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_a23KeyTyped
    if (a23.getText().length() > 2) {
            a23.setText(a23.getText().substring(0, 2));
        }
    
    while (!ComprobarHexadecimal(a23.getText())) {
            a23.setText(a23.getText().substring(0, a23.getText().length() - 1));
        }
}//GEN-LAST:event_a23KeyTyped

private void a23KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_a23KeyReleased
    a23KeyTyped(evt);
}//GEN-LAST:event_a23KeyReleased

private void a24KeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_a24KeyTyped
    if (a24.getText().length() > 2) {
            a24.setText(a24.getText().substring(0, 2));
        }
    
    while (!ComprobarHexadecimal(a24.getText())) {
            a24.setText(a24.getText().substring(0, a24.getText().length() - 1));
        }
}//GEN-LAST:event_a24KeyTyped

private void a24KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_a24KeyReleased
    a24KeyTyped(evt);
}//GEN-LAST:event_a24KeyReleased

private void a31KeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_a31KeyTyped
    if (a31.getText().length() > 2) {
            a31.setText(a31.getText().substring(0, 2));
        }
    
    while (!ComprobarHexadecimal(a31.getText())) {
            a31.setText(a31.getText().substring(0, a31.getText().length() - 1));
        }
}//GEN-LAST:event_a31KeyTyped

private void a31KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_a31KeyReleased
    a31KeyTyped(evt);
}//GEN-LAST:event_a31KeyReleased

private void a32KeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_a32KeyTyped
    if (a32.getText().length() > 2) {
            a32.setText(a32.getText().substring(0, 2));
        }
    
    while (!ComprobarHexadecimal(a32.getText())) {
            a32.setText(a32.getText().substring(0, a32.getText().length() - 1));
        }
}//GEN-LAST:event_a32KeyTyped

private void a32KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_a32KeyReleased
    a32KeyTyped(evt);
}//GEN-LAST:event_a32KeyReleased

private void a33KeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_a33KeyTyped
    if (a33.getText().length() > 2) {
            a33.setText(a33.getText().substring(0, 2));
        }
    
    while (!ComprobarHexadecimal(a33.getText())) {
            a33.setText(a33.getText().substring(0, a33.getText().length() - 1));
        }
}//GEN-LAST:event_a33KeyTyped

private void a33KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_a33KeyReleased
    a33KeyTyped(evt);
}//GEN-LAST:event_a33KeyReleased

private void a34KeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_a34KeyTyped
    if (a34.getText().length() > 2) {
            a34.setText(a34.getText().substring(0, 2));
        }
    
    while (!ComprobarHexadecimal(a34.getText())) {
            a34.setText(a34.getText().substring(0, a34.getText().length() - 1));
        }
}//GEN-LAST:event_a34KeyTyped

private void a34KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_a34KeyReleased
    a34KeyTyped(evt);
}//GEN-LAST:event_a34KeyReleased

private void a41KeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_a41KeyTyped
    if (a41.getText().length() > 2) {
            a41.setText(a41.getText().substring(0, 2));
        }
    
    while (!ComprobarHexadecimal(a41.getText())) {
            a41.setText(a41.getText().substring(0, a41.getText().length() - 1));
        }
}//GEN-LAST:event_a41KeyTyped

private void a41KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_a41KeyReleased
    a41KeyTyped(evt);
}//GEN-LAST:event_a41KeyReleased

private void a42KeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_a42KeyTyped
    if (a42.getText().length() > 2) {
            a42.setText(a42.getText().substring(0, 2));
        }
    
    while (!ComprobarHexadecimal(a42.getText())) {
            a42.setText(a42.getText().substring(0, a42.getText().length() - 1));
        }
}//GEN-LAST:event_a42KeyTyped

private void a42KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_a42KeyReleased
    a42KeyTyped(evt);
}//GEN-LAST:event_a42KeyReleased

private void a43KeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_a43KeyTyped
    if (a43.getText().length() > 2) {
            a43.setText(a43.getText().substring(0, 2));
        }
    
    while (!ComprobarHexadecimal(a43.getText())) {
            a43.setText(a43.getText().substring(0, a43.getText().length() - 1));
        }
}//GEN-LAST:event_a43KeyTyped

private void a43KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_a43KeyReleased
    a43KeyTyped(evt);
}//GEN-LAST:event_a43KeyReleased

private void a44KeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_a44KeyTyped
    if (a44.getText().length() > 2) {
            a44.setText(a44.getText().substring(0, 2));
        }
    
    while (!ComprobarHexadecimal(a44.getText())) {
            a44.setText(a44.getText().substring(0, a44.getText().length() - 1));
        }
}//GEN-LAST:event_a44KeyTyped

private void a44KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_a44KeyReleased
    a44KeyTyped(evt);
}//GEN-LAST:event_a44KeyReleased

private void cleanFieldsMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cleanFieldsMenuActionPerformed
    a11.setText("");
    a12.setText("");
    a13.setText("");
    a14.setText("");
    a21.setText("");
    a22.setText("");
    a23.setText("");
    a24.setText("");
    a31.setText("");
    a32.setText("");
    a33.setText("");
    a34.setText("");
    a41.setText("");
    a42.setText("");
    a43.setText("");
    a44.setText("");
    b11.setText("");
    b12.setText("");
    b13.setText("");
    b14.setText("");
    b21.setText("");
    b22.setText("");
    b23.setText("");
    b24.setText("");
    b31.setText("");
    b32.setText("");
    b33.setText("");
    b34.setText("");
    b41.setText("");
    b42.setText("");
    b43.setText("");
    b44.setText("");    
}//GEN-LAST:event_cleanFieldsMenuActionPerformed

    /**
    * @param args the command line arguments
    */
   

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton AtrasButton;
    private javax.swing.JButton BotonInfo;
    private javax.swing.JMenuItem Contenidos;
    private javax.swing.JMenuItem CopiarInput;
    private javax.swing.JMenuItem CopiarOutput;
    private javax.swing.JButton EjecutarButton;
    private javax.swing.JButton RandomButton;
    private javax.swing.JMenuItem Salir;
    private javax.swing.JTextField a11;
    private javax.swing.JTextField a12;
    private javax.swing.JTextField a13;
    private javax.swing.JTextField a14;
    private javax.swing.JTextField a21;
    private javax.swing.JTextField a22;
    private javax.swing.JTextField a23;
    private javax.swing.JTextField a24;
    private javax.swing.JTextField a31;
    private javax.swing.JTextField a32;
    private javax.swing.JTextField a33;
    private javax.swing.JTextField a34;
    private javax.swing.JTextField a41;
    private javax.swing.JTextField a42;
    private javax.swing.JTextField a43;
    private javax.swing.JTextField a44;
    private javax.swing.JMenuItem acercade;
    private javax.swing.JTextField b11;
    private javax.swing.JTextField b12;
    private javax.swing.JTextField b13;
    private javax.swing.JTextField b14;
    private javax.swing.JTextField b21;
    private javax.swing.JTextField b22;
    private javax.swing.JTextField b23;
    private javax.swing.JTextField b24;
    private javax.swing.JTextField b31;
    private javax.swing.JTextField b32;
    private javax.swing.JTextField b33;
    private javax.swing.JTextField b34;
    private javax.swing.JTextField b41;
    private javax.swing.JTextField b42;
    private javax.swing.JTextField b43;
    private javax.swing.JTextField b44;
    private javax.swing.JMenuBar cifradoMenuBarMain;
    private javax.swing.JMenuItem cleanFieldsMenu;
    private javax.swing.JPanel inputPanel;
    private javax.swing.JMenu mainMenuArchivoCifrado;
    private javax.swing.JMenu mainMenuAyudaCifrado;
    private javax.swing.JMenu mainMenuEditarCifrado;
    private javax.swing.JPanel outputPanel;
    private javax.swing.JMenuItem pegarInput;
    private javax.swing.JLabel titleLabel;
    // End of variables declaration//GEN-END:variables

}
